import request from '@/utils/request'

// 获取学生考试活动列表
export function getStudentActivities(groupId, queryParams) {
  return request({
    url: `/student/exam/list`,
    method: 'get',
    params: {
      ...queryParams,
      groupId: groupId
    }
  })
}

// 获取学生成绩列表
export function getStudentScores(groupId, queryParams) {
  return request({
    url: `/student/exam/group/${groupId}/scores`,
    method: 'get',
    params: queryParams
  })
}

// 获取成绩详情
export function getScoreDetail(scoreId) {
  return request({
    url: `/student/exam/score/${scoreId}`,
    method: 'get'
  })
}

// 获取考试组成员列表
export function getGroupMembers(groupId, queryParams) {
  return request({
    url: `/student/group/member/list`,
    method: 'get',
    params: {
      ...queryParams,
      groupId: groupId
    }
  })
}

// 获取活动详情
export function getActivityDetail(examId) {
  return request({
    url: `/student/exam/${examId}`,
    method: 'get'
  })
}

// 获取考试详情
export function getExamDetail(examId) {
  return request({
    url: `/student/exam/detail/${examId}`,
    method: 'get'
  })
}

// 提交考试
export function submitExam(examId, answers) {
  return request({
    url: `/student/exam/submit/${examId}`,
    method: 'post',
    data: { answers }
  })
}

// 保存考试草稿
export function saveExamDraft(examId, answers) {
  return request({
    url: `/student/exam/saveDraft/${examId}`,
    method: 'post',
    data: { answers }
  })
}

// 身份验证
export function verifyIdentity(data) {
  return request({
    url: '/student/exam/verify-identity',
    method: 'post',
    data: data
  })
}

// 获取考试组详情
export function getGroupDetail(groupId) {
  return request({
    url: '/exam/group/detail/student' + groupId,
    method: 'get',
  })
}
